package com.fasteat.menu.service.client;

import com.fasteat.common.entity.Result;
import com.fasteat.menu.entity.client.SearchCondition;
import com.fasteat.menu.handler.SearchFallback;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author run
 * @since 2021/2/18 15:29
 */
@FeignClient(value = "fasteat-search-service",fallback = SearchFallback.class)
public interface SearchClient {

    @DeleteMapping("/search/menu/{id}")
    public Result deleteMenuById(@PathVariable(name = "id") String id);

    @PostMapping("/search/menu")
    public Result searchMenuDefault(@RequestBody SearchCondition searchCondition);

    @PostMapping("/search/menu/{menuCommentSort}/{menuPraiseSort}/{timeSort}")
    public Result searchMenu(@RequestBody SearchCondition searchCondition
                                    ,@PathVariable(name = "menuCommentSort") @ApiParam(required = true, value = "0、默认方式，1、菜谱评论数升序，2、菜谱评论数降序") int menuCommentSort
                                    ,@PathVariable(name = "menuPraiseSort") @ApiParam(required = true, value = "0、默认方式，1、菜谱点赞数升序，2、菜谱点赞数降序") int menuPraiseSort
                                    ,@PathVariable(name = "timeSort") @ApiParam(required = true, value = "0、默认方式，1、时间升序，2、时间降序") int timeSort);
}
